home *** CD-ROM | disk | FTP | other *** search
/ Aminet 41 / Aminet 41 (2001)(Schatztruhe)[!][Feb 2001].iso / Guides / PicsData / Rexx / PZ_MakeThumbNail.rexx < prev   
OS/2 REXX Batch file  |  1993-11-11  |  2KB  |  131 lines

  1. /*
  2. **  $VER: $Id: PZ_MakeThumbNail.rexx,v 5.0 1993/11/12 01:16:07 chris Exp $
  3. **  Copyright (C) 1992, 1993 by Christian A. Weber, Zürich, Switzerland.
  4. **
  5. **  Creates a thumbnail picture for later use by MakeContact.rexx.
  6. **
  7. **  You may wish to change MAXMEM for ADPro if you don't have enough RAM,
  8. **  and the delay after loading if you have a slow HD :)
  9. */
  10.  
  11. options results
  12. arg adprodir inname text maxwidth maxheight outname
  13. address 'ADPro'
  14.  
  15.  
  16. /*
  17. ** Make sure ADPro is running
  18. */
  19. IF ~show(ports,'ADPro') THEN
  20. DO
  21.     Address COMMAND 'C:Assign ADPRO: '||adprodir
  22.     Address COMMAND 'Run >NIL: ADPRO:ADPro MAXMEM=5000000 BEHIND'
  23.     Address COMMAND 'C:Wait 5'
  24.     IF ~show(ports,'ADPro') THEN EXIT
  25. END
  26.  
  27.  
  28. /*
  29. ** Screen types for ADPro
  30. */
  31. LORES        = 0
  32. HIRES        = 1
  33. LACE        = 2
  34. PAL        = 4
  35. XOVERSCAN    = 8
  36. YOVERSCAN    = 16
  37.  
  38. HIRESBIT    = 0
  39. LACEBIT        = 1
  40.  
  41.  
  42. /*
  43. ** Adjust for text and borders
  44. */
  45. maxwidth  = maxwidth  - 2
  46. maxheight = maxheight - 18
  47.  
  48.  
  49. /*
  50. ** Now load the picture ...
  51. */
  52. LFORMAT        'UNIVERSAL'
  53. LOAD        inname
  54.  
  55. IF RC == 0 THEN DO
  56.  
  57.     /*
  58.     ** Get the picture size
  59.     */
  60.     XSIZE
  61.     origwidth  = ADPRO_RESULT
  62.     YSIZE
  63.     origheight = ADPRO_RESULT
  64.  
  65.  
  66.     IF origwidth > origheight THEN DO
  67.         width  = maxwidth
  68.         height = (origheight * maxwidth) / origwidth
  69.     END
  70.     ELSE DO
  71.         width  = (origwidth * maxheight) / origheight
  72.         height = maxheight
  73.     END
  74.  
  75.  
  76.     /*
  77.     ** Make sure we get the best dynamic range
  78.     */
  79.     OPERATOR    DYNAMIC_RANGE 0 255
  80.  
  81.  
  82.     /*
  83.     ** Now we scale the image to width/height
  84.     */
  85.     ABS_SCALE    width height
  86.  
  87.  
  88.     /*
  89.     ** Now save the image
  90.     */
  91.     SFORMAT        'IFF'
  92.     SAVE        outname RAW
  93.  
  94.  
  95.     /*
  96.     ** Create a backdrop with room for the text
  97.     */
  98.     LFORMAT            BACKDROP
  99.     LOAD               dummy maxwidth+2 maxheight+18 COLOR 60 40 60
  100.     OPERATOR RECTANGLE 0 0 maxwidth+2 maxheight+18 1 255 235 245 100
  101.  
  102.  
  103.     /*
  104.     ** Load the image under the text
  105.     */
  106.     LFORMAT        'UNIVERSAL'
  107.     LOAD        outname 1 17 100 0 0 0
  108.  
  109.  
  110.     /*
  111.     ** Render the text
  112.     */
  113.     OPERATOR TEXT_VISUAL RENDER_TYPE MIX FONT_NAME topaz.font SET_FONT_SIZE 11 SET_COLORS 255 255 255 SET_SATURATION 100 SET_TINT 100 STRING text CENTER_XOFFSET SET_YOFFSET 3 DRAW
  114.  
  115.  
  116.     /*
  117.     ** Now save the image again
  118.     */
  119.     SFORMAT        'IFF'
  120.     SAVE        outname RAW
  121.  
  122. END
  123. ELSE DO
  124.  
  125.     /*
  126.     ** LOAD returned an error
  127.     */
  128.     say filename || ': not a picture'
  129. END
  130.  
  131.